<?php

class Admin_Form_Newdunnagematerial extends Zend_Form {

    public function init() {
        parent::init();
        $this->initFields();
    }

    public function initFields() {
        $elements = array();

        $type = new Zend_Form_Element_Text("type");
        $type->setRequired(true);
        $elements[] = $type;

        $unit = new Zend_Form_Element_Select("unit");
        $unit->setRequired(true);
        $unit->setMultiOptions(Core_Util::getAllUnit());
        $elements[] = $unit;

        $price_per_unit = new Zend_Form_Element_Text("price_per_unit");
        $price_per_unit->setRequired(true);
        $price_per_unit->addValidator(new Zend_Validate_Float());
        $elements[] = $price_per_unit;
        $this->addElements($elements);
    }
    
    protected function createRequiredField($name) {
        $element = new Zend_Form_Element_Text($name);
        $element->setRequired();
        return $element;
    }

}

?>
